import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:seedfour/app/constants.dart';
import 'package:seedfour/app/models/message_list_entity.dart';

import '../../../models/notice_v2_list_entity.dart';
import '../../../models/statistics_entity.dart';

class HomeState {
  var title = ''.obs;
  var iconUrl = ''.obs;

  /// 功能按钮数据源
  var navigateIconList = <NavigationButtonItemInfo>[].obs;

  final iconSize = 36.w;

  final typePrint = 'print';
  final typeReceipt = 'receipt';

  final loadingTip = '加载中...';
  final noMoreTip = '没有更多了';

  var page = 1;
  final pageSize = 20;

  var isLoading = true.obs;
  var hasMessage = false.obs;
  var hasNotice = false.obs;
  var hasNewMessage = false.obs;
  var hasNewNotice = false.obs;
  var bottomTips = ''.obs;

  var messageCount = 0.obs;

  var statisticsTitles = ['收入', '支出'].obs;
  var statisticsCurrentIndex = 0.obs;
  var createPaperType = Rxn<SealPaperType>();
  var messageList = <MessageData>[].obs;
  var noticeList = <NoticeV2Data>[].obs;

  var statisticsInfo = StatisticsEntity().obs;

  var selectedPrintIndex = 0.obs;

  double cardWidth = (Get.width - kSpaceSmall * 3) / 2;

  final GlobalKey<FormState> formKey = GlobalKey<FormState>();

  HomeState() {
    navigateIconList.addAll([
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/taxi.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '用车',
        businessType: BusinessType.taxi,
      ),
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/take_out.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '外卖',
        businessType: BusinessType.takeOut,
      ),
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/dine.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '餐厅',
        businessType: BusinessType.pay,
      ),
      // NavigationButtonItemInfo(
      //   iconPath: 'assets/home_navigation_icons/print.png',
      //   iconWidth: iconSize,
      //   iconHeight: iconSize,
      //   name: '用印',
      //   businessType: typePrint,
      // ),
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/discount.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '折扣',
        businessType: BusinessType.discount,
      ),
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/jd.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '京东',
        businessType: BusinessType.jd,
      ),
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/train.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '火车',
        businessType: BusinessType.trainTicket,
      ),
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/airplane.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '飞机',
        businessType: BusinessType.airTicket,
      ),
      NavigationButtonItemInfo(
        iconPath: 'assets/home_navigation_icons/hotel.png',
        iconWidth: iconSize,
        iconHeight: iconSize,
        name: '酒店',
        businessType: BusinessType.hotel,
      ),
    ]);
  }
}

class NavigationButtonItemInfo {
  /// 按钮路径
  String iconPath;

  /// 按钮图标宽度
  double iconWidth;

  /// 按钮图标高度
  double iconHeight;

  /// 按钮名称
  String name;

  /// 按钮功能类型
  String businessType;

  NavigationButtonItemInfo({
    required this.iconPath,
    required this.iconWidth,
    required this.iconHeight,
    required this.name,
    required this.businessType,
  });
}
